import instance from "../utlis/axios/request"
 
export const state = () => {
    return {
        classList: []
    }
}

export const mutations = {
    GET_CLASSIFY_LIST(state, data) {
        console.log(data);
        state.classList = data
    }
}

export const actions = {
    async getList({ commit }, name) {

        let { data } = await this.$axios.get("http://localhost:2345/classify/list")

        commit("GET_CLASSIFY_LIST", data.data)
    },
    async addList({ commit, dispatch }, name) {
        name = JSON.stringify(name)
        let { data } = await instance({
            url:"http://localhost:2345/classify/addList",
            method:"post",
            data:{
                name
            }

        })
        dispatch("getList")
    },
   async deleteClissIfy({dispatch},ids){
       console.log(ids);
   
        let res = await instance({
            url:"http://localhost:2345/classify/delList",
            method:"post",
            data:{
                ids
            }
        })
        console.log(res);
       
        dispatch("getList")

    }

}

export const getters = {


}